package com.itheima.set;

import java.util.Set;
import java.util.TreeSet;

/*
Set 的基本使用
存取 无序
TreeSet数据有序
 */
public class Demo01 {
    public static void main(String[] args) {
        Set<String> set = new TreeSet<>();
        set.add("def");
        set.add("jmn");
        set.add("abcBB");
        set.add("ghi");
        set.add("abc");
        System.out.println(set.contains("abc"));
        System.out.println(set.contains("cba"));


        System.out.println(set.size());
        System.out.println(set);//[abc, def, ghi, jmn]
        set.remove("abc");
        System.out.println(set);
        set.removeIf(s->s.length()==3);
        System.out.println(set);
        System.out.println(set.size());
        System.out.println(set.isEmpty());
        set.clear();
        System.out.println(set.isEmpty());

    }
}
